import request from '@/scripts/request'

//登录
export function getUserInfo(yzhExchangeToken) {
  return request({
    url: `service/gateDam/overSituation/getUserInfo`,
    method: 'get',
    params: {
      yzhExchangeToken: yzhExchangeToken,
      source: 'middle'
    },
  })
}

//获取船闸列表
export function getShipLock(type) {
  return request({
    url: `service/gateDam/overSituation/getShipLock`,
    method: 'get',
    params: {
      type
    },
  })
}
export function getShipLockSmall(type) {
  return request({
    url: `service/gateDam/overSituation/getShipLockSmall`,
    method: 'get',
    params: {
      type
    },
  })
}
export function getLockGroup() {
  return request.get(`service/gateDam/overSituation/getLockGroup`)
}

//基本情况
export function baseView() {
  return request.get(`service/gateDam/overSituation/baseView`)
}

//过闸船舶统计分析
export function shipLockAlys(shipLockName, startTime, endTime) {
  let params = {
    startTime,
    endTime,
  };
  if(shipLockName){
    params.shipLockName = shipLockName;
  }
  return request({
    url: `service/gateDam/overSituation/shipLockAlys`,
    method: 'get',
    params: params,
  })
}

//过闸船舶货物类型统计分析
export function goodsAnalysis(shipLockName, startTime, endTime) {
  let params = {
    startTime,
    endTime,
  };
  if(shipLockName){
    params.shipLockName = shipLockName;
  }
  return request({
    url: `service/gateDam/overSituation/goodsAnalysis`,
    method: 'get',
    params: params,
  })
}

//过闸船舶货物吨位统计分析
export function goodsTonAlys(shipLockName, startTime, endTime) {
  let params = {
    startTime,
    endTime,
  };
  if(shipLockName){
    params.shipLockName = shipLockName;
  }
  return request({
    url: `service/gateDam/overSituation/goodsTonAlys`,
    method: 'get',
    params: params,
  })
}

//变形监测统计分析
export function deformationAlys() {
  return request({
    url: `service/gateDam/overSituation/deformationAlys`,
    method: 'get',
  })
}
export function defAlySmall() {
  return request({
    url: `service/gateDam/overSituation/defAlySmall`,
    method: 'get',
  })
}

//变形监测统计分析详情
export function deformationAlysDetail(pid) {
  return request({
    url: `service/gateDam/overSituation/deformationAlysDetail`,
    method: 'get',
    params: {
      pid,
    },
  })
}

//变形监测观测周期统计分析
export function circleAlys() {
  return request({
    url: `service/gateDam/overSituation/circleAlys`,
    method: 'get',
  })
}

//闸坝概况基本信息
export function baseInfo(shipLockName) {
  return request({
    url: `service/gateDam/gateSituation/baseInfo`,
    method: 'get',
    params: {
      shipLockName,
    },
  })
}

//航道通告
export function waterWayNotice() {
  return request({
    url: `service/gateDam/gateSituation/waterWayNotice`,
    method: 'get',
  })
}

//所有航道通告
export function allWaterWayNotice(keyword, unit, startTime, endTime, page, size) {
  let params = {
    page,
    size,
  };
  if(keyword){
    params.keyword = keyword;
  }
  if(unit){
    params.unit = unit;
  }
  if(startTime){
    params.startTime = startTime;
  }
  if(endTime){
    params.endTime = endTime;
  }
  return request({
    url: `service/gateDam/gateSituation/allWaterWayNotice`,
    method: 'get',
    params: params,
  })
}

//通告发布机构
export function pubUnit() {
  return request({
    url: `service/gateDam/gateSituation/pubUnit`,
    method: 'get',
  })
}

//变形监测分析(多点单周期)
export function defAyls(shipLockName, cyc) {
  return request({
    url: `service/gateDam/gateSituation/defAyls`,
    method: 'get',
    params: {
      shipLockName,
      cyc,
    }
  })
}

//变形监测分析(单点多周期)
export function defSingleAyls(start, end, type, pointName, shipLockName) {
  return request({
    url: `service/gateDam/gateSituation/defSingleAyls`,
    method: 'get',
    params: {
      start,
      end,
      type,
      pointName,
      shipLockName,
    }
  })
}

//获取周期列表
export function getCycList(shipLockName) {
  return request({
    url: `service/gateDam/gateSituation/getCycList`,    
    method: 'get',
    params: {
      shipLockName,      
    },
  })
}

//原始数据
export function defBaseData(shipLockName, startTime, endTime, page, size) {
  let params = {
    shipLockName,
    page,
    size,
  };
  if(startTime){
    params.startTime = startTime;
  }
  if(endTime){
    params.endTime = endTime;
  }
  return request({
    url: `service/gateDam/gateSituation/defBaseData`,    
    method: 'get',
    params: params,
  })
}

//除险加固记录、安全检查
export function addStrong(shipLockName) {
  return request({
    url: `service/gateDam/gateSituation/addStrong`,
    method: 'get',
    params: {
      shipLockName,
    }
  })
}

//水位变化统计分析
export function waterAlys(shipLockName, startTime) {
  return request({
    url: `service/gateDam/overSituation/waterAlys`,    
    method: 'get',
    params: {
      shipLockName,
      startTime,
    },
  })
}

//日常维护记录
export function dailyRecord(startTime, type, shipLockName) {
  return request({
    url: `service/gateDam/gateSituation/dailyRecord`,    
    method: 'get',
    params: {
      startTime,
      type,
      shipLockName,      
    },
  })
}

//船闸操作记录
export function operateRecord(shipLockName, page, size) {
  return request({
    url: `service/gateDam/gateSituation/operateRecord`,    
    method: 'get',
    params: {
      shipLockName,   
      page,
      size,   
    },
  })
}

//获取视频点
export function videoDirectory(shipLockName) {
  return request({
    url: `service/gateDam/gateSituation/videoDirectory`,    
    method: 'get',
    params: {
      shipLockName,  
    },
  })
}

//获取视频URL
export function geVideotUrl(resid) {
  return request({
    url: `service/gateDam/gateSituation/getUrl`,    
    method: 'get',
    params: {
      resid,  
    },
  })
}

//总体概况地图数据
export function screenMapData() {
  return request({
    url: `service/gateDam/overSituation/screenData`,    
    method: 'get',
  })
}

//获取地图点位
export function getPosition(params) {
  return request({
    url: `service/gateDam/overSituation/getPosition`,    
    method: 'get',
    params: params
  })
}

//实时水位统计分析
export function newWater() {
  return request({
    url: `service/gateDam/overSituation/newWater`,    
    method: 'get',
  })
}

//历史水位
export function theHighLow(shipLock) {
  return request({
    url: `service/gateDam/overSituation/theHighLow`,    
    method: 'get',
    params: {
      shipLock,  
    },
  })
}

//监测点统计
export function defInfo(shipLockName) {
  return request({
    url: `service/gateDam/gateSituation/defInfo`,    
    method: 'get',
    params: {
      shipLockName,  
    },
  })
}
//变形监测观测周期统计
export function cycleStatis(shipLockName) {
  return request({
    url: `service/gateDam/gateSituation/cycleStatis`,    
    method: 'get',
    params: {
      shipLockName,  
    },
  })
}

//日常维护记录
export function dailyRecordSmall(startTime, type, shipLockName) {
  return request({
    url: `service/gateDam/gateSituation/dailyRecordSmall`,    
    method: 'get',
    params: {
      startTime,
      type,
      shipLockName,      
    },
  })
}

//气象-获取市
export function getProvince() {
  return request({
    url: `service/gateDam/overSituation/getProvince`,    
    method: 'get',
  })
}

//气象统计
export function weatherStat(city,year) {
  return request({
    url: `service/gateDam/overSituation/weatherStat`,    
    method: 'get',
    params: {
      city, 
      year
    },
  })
}

//获取地图点位（大屏）
export function getPositionBig(params) {
  return request({
    url: `service/gateDam/overSituation/getPositionBig`,    
    method: 'get',
    params: params
  })
}